//
// Created by Administrator on 2021-12-14.
//
#include "../sds.h"
#include "stdio.h"

void test2();
void test1();
int main(int argc,char* argv[]){
    test2();
    return 0;
}

void test1(){
    const char* cstr = "哈哈hasjdhfjkashjkahazsdfasdf阿斯蒂芬";
    sds str = sdsnew(cstr);
    sdscatlen(str,"嘿嘿",6);
    size_t length = sdslen(str);
    printf("str length=%zu\n",length);
    printf("str type=%d\n",str[-1]);
    printf("120 >>> 3=%d\n",120>>3);
    printf("sdsalloc=%zu\n", sdsalloc(str));
    struct sdshdr8* sdshdr8 = (struct sdshdr8 *) (str - sizeof(struct sdshdr8));
    //printf("sizeof(struct sdshdr5)=%d\n", sizeof());
    printf("sizeof(struct sdshdr5)=%lu\n", sizeof(struct sdshdr5));
    printf("sizeof(struct sdshdr8)=%lu\n", sizeof(struct sdshdr8));
    printf("sizeof(struct sdshdr16)=%lu\n", sizeof(struct sdshdr16));
    printf("sizeof(struct sdshdr32)=%lu\n", sizeof(struct sdshdr32));
    printf("sizeof(struct sdshdr64)=%lu\n", sizeof(struct sdshdr64));
    printf("sdsavail=%zu\n", sdsavail(str));
    printf("sdshdr8=%d\n", sdshdr8->alloc);
}

void test2(){
    sds str1 = sdsnew("tjngdngkldnglknklasnflsakncflksahf阿萨德噶的说法klsfncslfhcsdncsdjkcnsdjk");
    sds str2 = sdsnew("嘿嘿");
    str2 = sdscpylen(str1,str2,20);
    printf("str1=%s\n",str1);
    printf("str2=%s\n",str2);
}


